package top.pcat.server;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpRequestDecoder;
import io.netty.handler.codec.http.HttpResponseEncoder;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class MyChannelInitalizer extends ChannelInitializer<SocketChannel> {


    protected void initChannel(SocketChannel ch) throws Exception {
        ChannelPipeline pipeline = ch.pipeline();
        log.info("init");
        pipeline.addLast("MyHttpResponseEncoder", new HttpResponseEncoder());
        pipeline.addLast("MyHttpRequestDecoder", new HttpRequestDecoder());
        pipeline.addLast("MyHttpServerHandler", new GateWayServerHandler());
    }
}